# ! / usr / bin / env
# python
# -- coding: utf - 8 - -
# author：wang
# time: 2024 / 11 / 10
import file_word_analyze
def similar_essay(keywords1,keywords2):
    common_words = set(keywords1) & set(keywords2)
    similarity = len(common_words) / 10 * 100
    print(f"重合率是{similarity}%\n")


file_path1=r"C:\Users\lx\Pictures\Saved Pictures\如何加强新时代党的建设.txt"
text1=file_word_analyze.read_text(file_path1)
keywords1=file_word_analyze.analyze_keywords(text1,file_path1)
print (keywords1)
file_path2=r"C:\Users\lx\Pictures\Saved Pictures\如何加强新时代党的建设.txt"
text2=file_word_analyze.read_text(file_path2)
keywords2=file_word_analyze.analyze_keywords(text2,file_path2)
print (keywords2)
similar_essay(keywords1,keywords2)


